Examples: query, "exact match", wildcard*, wild?ard, wild*rd
Fuzzy search: cake~ (finds cakes, bake)
Term boost: "red velvet"^4, chocolate^2
Field grouping: tags:(+work -"fun-stuff")
Escaping: Escape characters +-&|!(){}[]^"~*?:\ with \, e.g. \+
Range search: properties.timestamp:[1587729413488 TO *] (inclusive), properties.title:{A TO Z}(excluding A and Z)
Combinations: chocolate AND vanilla, chocolate OR vanilla, (chocolate OR vanilla) NOT "vanilla pudding"
Field search: properties.title:"The Title" AND text
Answered
Hi All, There Is A Way To Get From A Task-Object The Experiment Source Code? In Other Words, Assume I Have Access To A Specific Trains Server And Want To Store From A Particular Task The Experiment Source Code In A Temp File. There Is A Convenient Way To

Hi all,
There is a way to get from a task-object the experiment source code? In other words, assume I have access to a specific trains server and want to store from a particular task the experiment source code in a temp file. There is a convenient way to do so?

  
  
Posted 3 years ago
Votes Newest

Answers 12


AgitatedDove14
Not sure if I got it right. Consider the following scenarios:
I wrote some code in kernel.py file and used the following line at the beginning: task = Task.init(project_name="my project", task_name="my task") . The kernel.py file exists only on my local machine (no git repo). At the end of the experiment running, the kernel.py source code will be in the "uncommitted changes" section in the task? If not, can the kernel.py file be reached from the task? I wrote some code in kernel.py file and used the following line at the beginning: task = Task.init(project_name="my project", task_name="my task") . Besides, the kernel.py file is under git VS and not yet committed. At the end of the experiment running, the kernel.py source code will be in the "uncommitted changes" section in the task? I wrote some code in kernel.py file and used the following line at the beginning: task = Task.init(project_name="my project", task_name="my task") . Besides, the kernel.py file is committed and pushed to my repo. At the end of the experiment running, can the kernel.py source code be reached from the task?

  
  
Posted 3 years ago

SpotlessFish46
yes you can access the entire code in the incomitted changes, you can test it with:task = Task.get_task(task_id='aabb') task_dict = task.export_task()2. correct, but then if you need the entire code base you need to clone the arepo and apply the uncommitted changes. Basically trains-agent does that when execute with build
trains-agent build --id aabb --target ~/my_task_env3. See (2)

  
  
Posted 3 years ago

SpotlessFish46 unless all the code is under "uncommitted changes" section, what you have is a link to the git repo + commit id

  
  
Posted 3 years ago

No. I am working on my local machine (python file) and running a simple example. Note that Trains working on a local server.

  
  
Posted 3 years ago

It should have worked....
Can you run the examples from the repo and see if they work?

  
  
Posted 3 years ago

AgitatedDove14 After running the line: task._wait_for_repo_detection()
I got the same empty result (diff:''). please advice.

  
  
Posted 3 years ago

AgitatedDove14 Yes, the expected result that I aim to is a string of the experiment source code.

  
  
Posted 3 years ago

Hmm are you running from inside the Kaggle jupyter thing ?

  
  
Posted 3 years ago

AgitatedDove14
I tried scenario number one, and task_dict didn't contain the source code of the experiment.

Please advice.

task_dict value:
{'id': 'b37dfbfbfc0c46c68dadc013fc775ab4', 'name': 'Hello Kaggle', 'user': '479fb9f76304483ba0bbc49e7118c70d', 'company': 'd1bd92a3b039400cbafc60a7a5b1e52b', 'type': 'training', 'status': 'completed', 'comment': 'Auto-generated at 2020-11-25 22:29:10 by tmankita@Tomers-MacBook-Pro.local', 'created': datetime.datetime(2020, 11, 25, 22, 23, 27, 947000, tzinfo=tzutc()), 'started': datetime.datetime(2020, 11, 25, 22, 29, 10, 967000, tzinfo=tzutc()), 'completed': datetime.datetime(2020, 11, 25, 22, 29, 11, 145000, tzinfo=tzutc()), 'project': '8b5bc5ee58f945eb9236788e51ddae09', 'output': {'destination': ''}, 'execution': {'parameters': {}, 'model_desc': {}, 'model_labels': {}, 'docker_cmd': ''}, 'script': {'binary': '', 'repository': '', 'tag': '', 'branch': '', 'version_num': '', 'entry_point': '', 'working_dir': '', 'requirements': {'pip': ''}, 'diff': ''}, 'tags': [], 'system_tags': ['development'], 'last_update': datetime.datetime(2020, 11, 25, 22, 29, 11, 292000, tzinfo=tzutc()), 'hyperparams': {}, 'configuration': {}, 'project_name': 'my project', 'session_api_version': '2.9'}

  
  
Posted 3 years ago

It should be under script.diff:
'script': {'binary': '', 'repository': '', 'tag': '', 'branch': '', 'version_num': '', 'entry_point': '', 'working_dir': '', 'requirements': {'pip': ''}, 'diff': ''}For some reason this is empty in your case, are you seeing it in the UI?
If you are querying the current task (i.e. running) it might not be there yet.
You can call this internal function that returns only after the repo detection is done.
task._wait_for_repo_detection()

  
  
Posted 3 years ago

AgitatedDove14
In the first scenario, there is no repo at all (client end), so which repo will detect?
According to the UI, the task status is complete, and I don't see the diff.
I will try to run this line task._wait_for_repo_detection() ,but I suspect the run will get stuck in an infinite loop.

  
  
Posted 3 years ago

SpotlessFish46 So the expected behavior is to have the single script inside the diff, but you get empty string ?

  
  
Posted 3 years ago